package cn.harry.modular.sys.domain;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 部门表
 *
 * @author honghh Date 2020-03-16 08:51:37 Copyright (C) www.tech-harry.cn
 */
@Data
@TableName("sys_dept")
public class SysDept implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	@TableId
	@Schema(description = "id")
	private Long id;

	/**
	 * 名称
	 */
	@Schema(description = "名称")
	private String name;

	/**
	 * 上级部门
	 */
	@Schema(description = "上级部门")
	private Long pid;

	/**
	 * 启用状态：0->禁用；1->启用
	 */
	@Schema(description = "启用状态：0->禁用；1->启用")
	private String status;

	/**
	 * 祖级列表
	 */
	@Schema(description = "祖级列表")
	private String ancestors;

	/**
	 * 排序
	 */
	@Schema(description = "排序")
	private Integer sort;

	/**
	 * 负责人
	 */
	@Schema(description = "负责人")
	private String leader;

	/**
	 * 联系电话
	 */
	@Schema(description = "联系电话")
	private String phone;

	/**
	 * 邮箱
	 */
	@Schema(description = "邮箱")
	private String email;

	/**
	 * 创建时间
	 */
	@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
	@Schema(description = "创建时间")
	private Date createTime;

	/**
	 * 修改时间
	 */
	@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
	@Schema(description = "修改时间")
	private Date modifyTime;

	/**
	 * 有效状态：0->无效；1->有效
	 */
	@TableLogic
	@Schema(description = "有效状态：0->无效；1->有效")
	private Integer valid;

	/**
	 * 子部门
	 */
	@TableField(exist = false)
	private List<SysDept> children = new ArrayList<>();

}
